home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1996 #6 / Amiga Plus CD - 1996 - No. 06.iso / pd / programmierung / programmers / proplayer.h < prev    next >
C/C++ Source or Header  |  1996-06-23  |  14KB  |  396 lines

  1. /* C definitions for using the 'proplayer.a' and 'pro8player.a'
  2.    play-routines of OctaMED (Pro/Ss). OctaMED Pro V5 specific
  3.    features are marked as (V5), V6 features as (V6) and Sound-
  4.    studio specific features as (V7)
  5. */
  6.  
  7. /* $VER: proplayer_h 7.0 (29.1.1996) */
  8.  
  9. #ifndef EXEC_TYPES_H
  10. #include <exec/types.h>
  11. #endif
  12.  
  13. #ifdef LATTICE
  14. #ifndef    OCTAPLR_LIB_PROTOS
  15. /* In 'proplayer.a' */
  16. LONG __asm InitPlayer(void);
  17. void __asm RemPlayer(void);
  18. void __asm PlayModule(register __a0 struct MMD0 *);
  19. void __asm ContModule(register __a0 struct MMD0 *);
  20. void __asm StopPlayer(void);
  21. void __asm SetTempo(register __d0 UWORD);
  22. /* In 'loadmod.a' */
  23. struct MMD0 * __asm LoadModule(register __a0 char *);
  24. struct MMD0 * __asm LoadModule_Fast(register __a0 char *);
  25. void __asm RelocModule(register __a0 struct MMD0 *);
  26. void __asm UnLoadModule(register __a0 struct MMD0 *);
  27. ULONG __asm RequiredPlayRoutine(register __a0 struct MMD0 *);
  28. ULONG __asm FastMemPlayRecommended(register __a0 struct MMD0 *);
  29. /* These are the definitions for the 8-channel OctaMED routines,
  30.    in 'pro8player.a' */
  31. LONG __asm InitPlayer8(void);
  32. void __asm RemPlayer8(void);
  33. void __asm PlayModule8(register __a0 struct MMD0 *);
  34. void __asm ContModule8(register __a0 struct MMD0 *);
  35. void __asm StopPlayer8(void);
  36. /* And the corresponding routines in 'promixplayer.a'... */
  37. LONG __asm InitPlayerM(void);
  38. void __asm RemPlayerM(void);
  39. void __asm PlayModuleM(register __a0 struct MMD0 *);
  40. void __asm ContModuleM(register __a0 struct MMD0 *);
  41. void __asm StopPlayerM(void);
  42. #endif
  43. #endif
  44.  
  45. /* If you're playing multi-modules, set the 'modnum' variable to the
  46.    number of the song you want to play before calling PlayModule(). */
  47.  
  48. #ifdef LATTICE_50
  49. extern UWORD far modnum;
  50.  
  51. /* 'modnum8' is the equivalent in 'mod8player' */
  52.  
  53. extern UWORD far modnum8;
  54. extern UBYTE far hq; /* (V6) */
  55. extern ULONG far mixbuffsize,mixfreq; /* (V7, mix) */
  56. extern UBYTE far mix14bit; /* (V7, mix) */
  57. extern UWORD far fastmemplay,fastmemplay8; /* (V7) */
  58. #else
  59. extern UWORD modnum,modnum8; /* for less intelligent compilers */
  60. extern UBYTE hq;
  61. extern ULONG mixbuffsize,mixfreq;
  62. extern UBYTE mix14bit;
  63. extern UWORD fastmemplay,fastmemplay8;
  64. #endif
  65.  
  66. /* This is the main module structure */
  67. struct MMD0 {    /* Also for MMD1 and MMD2 */
  68.     ULONG    id;            /* "MMD0"/"MMD1"/"MMD2" */
  69.     ULONG    modlen;            /* module length (in bytes) */
  70.     struct    MMD0song *song;        /* pointer to MMD0song */
  71.     UWORD    psecnum;        /* (MMD2) - used by the player */
  72.     UWORD    pseq;            /* (MMD2) - used by the player */
  73.     struct    MMD0block **blockarr;    /* pointer to pointers of blocks */
  74.     UBYTE    mmdflags;        /* see below... */
  75.     UBYTE    reserved[3];
  76.     struct    MMDSample **smplarr;    /* pointer to pointers of samples */
  77.     ULONG    reserved2;
  78.     struct    MMD0exp *expdata;    /* pointer to expansion data */
  79.     ULONG    reserved3;
  80. /* The following values are used by the play routine */
  81.     UWORD    pstate;            /* the state of the player */
  82.     UWORD    pblock;            /* current block */
  83.     UWORD    pline;            /* current line */
  84.     UWORD    pseqnum;        /* current # of playseqlist */
  85.     WORD    actplayline;        /* OBSOLETE!! SET TO 0xFFFF! */
  86.     UBYTE    counter;        /* delay between notes */
  87.     UBYTE    extra_songs;        /* number of additional songs, see
  88.                        expdata->nextmod */
  89. };
  90.  
  91. /* MMD0.mmdflags bit definitions: */
  92. /* this mod can always be loaded to fast memory (either uses the mixing
  93.    routine or is a pure MIDI or 8-channel song) */
  94. #define    MMD_LOADTOFASTMEM    0x1
  95.  
  96.  
  97. /* These are the structures for future expansions */
  98.  
  99. struct InstrExt {    /* This struct only for data required for playing */
  100. /* NOTE: THIS STRUCTURE MAY GROW IN THE FUTURE, TO GET THE CORRECT SIZE,
  101.    EXAMINE mmd0->expdata->s_ext_entrsz */
  102. /* ALSO NOTE: THIS STRUCTURE MAY BE SHORTER THAN DESCRIBED HERE,
  103.    EXAMINE mmd0->expdata->s_ext_entrsz */
  104.     UBYTE hold;
  105.     UBYTE decay;
  106.     UBYTE suppress_midi_off;    /* 1 = suppress, 0 = don't */
  107.     BYTE  finetune;
  108.     UBYTE default_pitch;    /* (V5) */
  109.     UBYTE instr_flags;    /* (V5) */
  110.     UWORD long_midi_preset;    /* (V5), overrides the preset in the
  111.         song structure, if this exists, MMD0sample/midipreset
  112.         should not be used. */
  113.     UBYTE output_device;    /* (V5.02, V6) */
  114.     UBYTE reserved;        /* currently unused */
  115. /* The following two variables override MMD0sample repeat settings. First,
  116.    they allow >128 k samples; second, they allow byte resolution */
  117.     ULONG long_repeat;    /* (V7) */
  118.     ULONG long_replen;    /* (V7) */
  119. };
  120.  
  121. /* Bits for instr_flags */
  122. #define SSFLG_LOOP    0x01
  123. #define    SSFLG_EXTPSET    0x02
  124. #define    SSFLG_DISABLED    0x04
  125. #define    SSFLG_PINGPONG    0X08    /* ping-pong loop [mixing only] */
  126.  
  127. /* Currently defined output_device values */
  128. #define    OUTPUT_STD    0
  129. #define    OUTPUT_MD16    1    /* Aura */
  130. #define    OUTPUT_TOCC    2
  131.  
  132. struct MMDInstrInfo {
  133.     UBYTE    name[40];
  134.     UBYTE    pad0;    /* two pads? */
  135.     UBYTE    pad1;
  136. };
  137.  
  138. struct MMD0exp {
  139.     struct MMD0 *nextmod;        /* for multi-modules */
  140.     struct InstrExt *exp_smp;    /* pointer to an array of InstrExts */
  141.     UWORD  s_ext_entries;        /* # of InstrExts in the array */
  142.     UWORD  s_ext_entrsz;        /* size of an InstrExt structure */
  143.     UBYTE  *annotxt;        /* 0-terminated message string */
  144.     ULONG  annolen;            /* length (including the 0-byte) */
  145. /* MED V3.20 data below... */
  146.     struct MMDInstrInfo *iinfo;    /* "secondary" InstrExt for info
  147.                        that does not affect output */
  148.     UWORD  i_ext_entries;        /* # of MMDInstrInfos */
  149.     UWORD  i_ext_entrsz;        /* size of one */
  150.     ULONG  jumpmask;        /* OBSOLETE in current OctaMEDs */
  151.     UWORD  *rgbtable;        /* pointer to 8 UWORD values,
  152.                        ignored by OctaMED V5 and later */
  153.     UBYTE  channelsplit[4];    /* for OctaMED only (non-zero = NOT splitted) */
  154.     struct NotationInfo *n_info;    /* OctaMED notation editor info data */
  155.     UBYTE  *songname;    /* song name */
  156.     ULONG  songnamelen;    /* length (including terminating zero) */
  157.     struct MMDDumpData *dumps; /* MIDI message dump data */
  158.     struct MMDInfo *mmdinfo;   /* (V6) annotation information */
  159.     struct MMDARexx *mmdrexx;  /* (V7) ARexx information */
  160.     struct MMDMIDICmd3x *mmdcmd3x; /* (V7) Command 3cxx settings */
  161. /* These are still left, they must be 0 at the moment. */
  162.     ULONG  reserved2[3];
  163. /* When the above three reserved fields are all used, the following
  164.    information will be represented as a tag list. Set this to zero
  165.    [TAG_END]. */
  166.     ULONG  tag_end;
  167. };
  168.  
  169. /* Info for each instrument (mmd0->song.sample[xx]) */
  170.  
  171. struct MMD0sample {
  172.     UWORD rep,replen;    /* repeat/repeat length */
  173.     UBYTE midich;        /* midi channel for curr. instrument */
  174.     UBYTE midipreset;    /* midi preset (1 - 128), 0 = no preset */
  175.     UBYTE svol;        /* default volume */
  176.     BYTE strans;        /* sample transpose */
  177. };
  178.  
  179. /* The song structure (mmd0->song) */
  180.  
  181. struct MMD0song {
  182.     struct MMD0sample sample[63];    /* info for each instrument */
  183.     UWORD    numblocks;        /* number of blocks in this song */
  184.     UWORD    songlen;        /* number of playseq entries */
  185.     UBYTE    playseq[256];        /* the playseq list */
  186.     UWORD    deftempo;        /* default tempo */
  187.     BYTE    playtransp;        /* play transpose */
  188.     UBYTE    flags;            /* flags (see below) */
  189.     UBYTE    flags2;            /* for future expansion */
  190.     UBYTE    tempo2;            /* 2ndary tempo (delay betw. notes) */
  191.     UBYTE    trkvol[16];        /* track volume */
  192.     UBYTE    mastervol;        /* master volume */
  193.     UBYTE    numsamples;        /* number of instruments */
  194. }; /* length = 788 bytes */
  195.  
  196. /* The new PlaySeq structure of MMD2 */
  197.  
  198. struct PlaySeq {
  199.     char    name[32];    /* (0)  31 chars + \0 */
  200.     ULONG    reserved[2];    /* (32) for possible extensions */
  201.     UWORD    length;        /* (40) # of entries */
  202. /* Commented out, not all compilers may like it... */
  203. /*    UWORD    seq[0];    */    /* (42) block numbers.. */
  204. /* Note: seq[] values above 0x7FFF are reserved for future expansion! */
  205. };
  206.  
  207. /* This structure is used in MMD2s, instead of the above one.
  208.    (Be sure to cast the pointer.) */
  209.  
  210. struct MMD2song {
  211.     struct MMD0sample sample[63];
  212.     UWORD    numblocks;
  213.     UWORD    songlen;    /* NOTE: number of sections in MMD2 */
  214.     struct    PlaySeq **playseqtable;
  215.     UWORD    *sectiontable;    /* UWORD section numbers */
  216.     UBYTE    *trackvols;    /* UBYTE track volumes */
  217.     UWORD    numtracks;    /* max. number of tracks in the song
  218.                    (also the number of entries in
  219.                     'trackvols' table) */
  220.     UWORD    numpseqs;    /* number of PlaySeqs in 'playseqtable' */
  221.     BYTE    *trackpans;    /* NULL means 'all centered */
  222.     ULONG    flags3;        /* see defs below */
  223.     UWORD    voladj;        /* volume adjust (%), 0 means 100 */
  224.     UWORD    channels;    /* mixing channels, 0 means 4 */
  225.     UBYTE    mix_echotype;    /* 0 = nothing, 1 = normal, 2 = cross */
  226.     UBYTE    mix_echodepth;    /* 1 - 6, 0 = default */
  227.     UWORD    mix_echolen;    /* echo length in milliseconds */
  228.     BYTE    mix_stereosep;    /* stereo separation */
  229.     UBYTE    pad0[223];    /* reserved for future expansion */
  230. /* Below fields are MMD0/MMD1-compatible (except pad1[]) */
  231.     UWORD    deftempo;
  232.     BYTE    playtransp;
  233.     UBYTE    flags;
  234.     UBYTE    flags2;
  235.     UBYTE    tempo2;
  236.     UBYTE    pad1[16];    /* used to be trackvols, in MMD2 reserved */
  237.     UBYTE    mastervol;
  238.     UBYTE    numsamples;
  239. };
  240.  
  241.  /* FLAGS of the above structure */
  242. #define    FLAG_FILTERON    0x1    /* hardware low-pass filter */
  243. #define    FLAG_JUMPINGON    0x2    /* OBSOLETE now, but retained for compatibility */
  244. #define    FLAG_JUMP8TH    0x4    /* also OBSOLETE */
  245. #define    FLAG_INSTRSATT    0x8    /* instruments are attached (sng+samples)
  246.                    used only in saved MED-songs */
  247. #define    FLAG_VOLHEX    0x10    /* volumes are represented as hex */
  248. #define FLAG_STSLIDE    0x20    /* no effects on 1st timing pulse (STS) */
  249. #define FLAG_8CHANNEL    0x40    /* OctaMED 8 channel song, examine this bit
  250.                    to find out which routine to use */
  251. #define    FLAG_SLOWHQ    0x80    /* HQ slows playing speed (V2-V4 compatibility) */
  252. /* flags2 */
  253. #define FLAG2_BMASK    0x1F
  254. #define FLAG2_BPM    0x20
  255. #define    FLAG2_MIX    0x80    /* uses Mixing (V7+), this is IMPORTANT! */
  256. /* flags3 */
  257. #define    FLAG3_STEREO    0x1    /* mixing in Stereo mode */
  258. #define    FLAG3_FREEPAN    0x2    /* free panning */
  259.  
  260. struct MMDDump {
  261.     ULONG    length;        /* dump data length */
  262.     UBYTE    *data;        /* data pointer */
  263.     UWORD    ext_len;    /* bytes remaining in this struct */
  264. /* ext_len >= 20: */
  265.     UBYTE    name[20];    /* message name (null-terminated) */
  266. };
  267.  
  268. struct MMDDumpData {
  269.     UWORD    numdumps;    /* number of message dumps */
  270.     UWORD    reserved[3];    /* not currently used */
  271. };    // Followed by <numdumps> pointers to struct MMDDump
  272.  
  273. /* Designed so that several info items can exist (in V6 only one supported),
  274.    you must also check the data type before using it, currently only text is
  275.    supported, but more types can be added in the future.
  276.  
  277.    Text is stored in plain Amiga ASCII, lines separated by \n characters.
  278.    The last byte is \0.
  279. */
  280. struct MMDInfo {
  281.     struct MMDInfo *next;    /* next info (currently not supported) */
  282.     UWORD    reserved;    /* 0 */
  283.     UWORD    type;        /* 1 = text, ignore ALL other types */
  284.     ULONG    length;        /* length of the following data */
  285. /*    UBYTE    data[0]; */    /* Comments may be removed in SAS/C V6 */
  286. };
  287.  
  288. /* flags in struct NotationInfo */
  289. #define NFLG_FLAT 1
  290. #define NFLG_3_4  2
  291.  
  292. struct NotationInfo {
  293.     UBYTE n_of_sharps;    /* number of #'s (or b's) */
  294.     UBYTE flags;        /* flags (see above) */
  295.     WORD  trksel[5];    /* selected track for each preset (-1 = none) */
  296.     UBYTE trkshow[16];    /* which tracks to show (bit 0 = for preset 0,
  297.                 bit 1 for preset 1 and so on..) */
  298.     UBYTE trkghost[16];    /* ghosted tracks (like trkshow[]) */
  299.     BYTE  notetr[63];       /* -24 - +24 (if bit #6 is negated, hidden) */
  300.     UBYTE pad;    /* perhaps info about future extensions */
  301. };
  302.  
  303. /* ctrlr_types */
  304. #define    MCS_TYPE_STD_MSB    0
  305. #define    MCS_TYPE_STD_LSB    1
  306. #define    MCS_TYPE_RPN_MSB    2
  307. #define    MCS_TYPE_RPN_LSB    3
  308. #define    MCS_TYPE_NRPN_MSB    4
  309. #define    MCS_TYPE_NRPN_LSB    5
  310.  
  311. struct MMDMIDICmd3x {
  312.     UBYTE struct_vers;    // current version = 0
  313.     UBYTE pad;
  314.     UWORD num_of_settings;    // number of Cmd3x settings (currently set to 15)
  315.     UBYTE *ctrlr_types;    // controller types [ignore unknown types!!]
  316.     UWORD *ctrlr_numbers;    // controller numbers
  317. };
  318.  
  319. struct MMDARexxTrigCmd {
  320.     struct MMDARexxTrigCmd *next; /* the next command, or NULL */
  321.     UBYTE cmdnum; /* command number (01..FF) */
  322.     UBYTE pad;
  323.     WORD cmdtype; /* command type (OMACTION_...) */
  324.     STRPTR cmd; /* command, or NULL */
  325.     STRPTR port; /* port, or NULL */
  326.     UWORD cmd_len; /* length of 'cmd' string (without term. 0) */
  327.     UWORD port_len; /* length of 'port' string (without term. 0) */
  328. }; /* current (V7) structure size: 20 */
  329.  
  330. /* command type definitions... ignore unrecognized cmdtypes! */
  331. #define    OMACTION_CMDSELF    0
  332. #define    OMACTION_RUNREXXPRG    1
  333. #define    OMACTION_CMDEXT        2
  334. #define    OMACTION_RUNPRG        3
  335.  
  336. struct MMDARexx {
  337.     UWORD    res;    /* reserved, must be zero! */
  338.     UWORD    trigcmdlen; /* size of trigcmd entries (MUST be used!!) */
  339.     struct    MMDARexxTrigCmd *trigcmd; /* a chain of MMDARexxTrigCmds, or NULL */
  340. };
  341.  
  342. /* This structure exists in V6+ blocks with multiple command pages */
  343. struct BlockCmdPageTable {
  344.     UWORD    num_pages;    // number of command pages
  345.     UWORD    reserved;    // zero = compatibility
  346.     UWORD    *page[0];    // page pointers follow...
  347. };
  348.  
  349. /* Below structs for MMD1 only! */
  350. struct BlockInfo {
  351.     ULONG    *hlmask;      /* highlight data */
  352.     UBYTE    *blockname;    /* block name */
  353.     ULONG    blocknamelen;    /* length of block name (including term. 0) */
  354.     struct    BlockCmdPageTable *pagetable;    /* (V6) command page table */
  355.     ULONG    reserved[5];    /* future expansion */
  356. };
  357.  
  358. struct MMD1Block {
  359.     UWORD numtracks;
  360.     UWORD lines;
  361.     struct BlockInfo *info;
  362. };
  363. #define MMD1BLKHDRSZ 8
  364.  
  365. /* This header exists in the beginning of each sample */
  366. struct MMDSample {
  367. /* length of one channel in bytes */
  368.     ULONG    length;
  369. /* see definitions below */
  370.     WORD    type;
  371. /* 8- or 16-bit data follows */
  372. };
  373.  
  374. /* Type definitions: */
  375. #define    SAMPLE        0
  376. #define    IFF5OCT        1
  377. #define    IFF3OCT        2
  378. #define IFF2OCT        3
  379. #define IFF4OCT        4
  380. #define IFF6OCT        5
  381. #define IFF7OCT        6
  382. /* low octaves usable */
  383. #define    EXTSAMPLE    7
  384. /* a standard synthsound */
  385. #define    SYNTHETIC    -1
  386. /* sample with synthetic information */
  387. #define    HYBRID        -2
  388. /* 16-bit (flag), only type SAMPLE supported */
  389. #define    S_16        0x10
  390. /* stereo (flag) */
  391. #define    STEREO        0x20
  392. /* only supported while reading... V5 Aura sample */
  393. #define    OBSOLETE_MD16    0x18
  394.  
  395. /* Please refer to 'MMD.txt' for a complete description of MMD file format. */
  396.